package com.my.blogapi.controller;

import com.my.blogapi.service.CommentService;
import com.my.blogapi.vo.param.CommentParam;
import com.my.blogapi.vo.param.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("comments")
public class CommentsController {

    @Autowired
    private CommentService commentService;
    ///comments/article/{id}
    @GetMapping("article/{id}")
    public Result article(@PathVariable("id") Long id) {
        System.out.println(id);
        return commentService.findCommentByArticle(id);
    }
    ///comments/create/change
    @PostMapping("create/change")
    public Result comment(@RequestBody CommentParam commentParam){
        return commentService.comment(commentParam);
    }
}
